package com.zw.yzk.kabu.data.repository;


import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.PayEntity;
import com.zw.yzk.kabu.data.network.service.PayService;
import com.zw.yzk.kabu.data.network.task.PayTask;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2016/12/24.
 */

public class PayRepository extends CommonRepository {

    @Inject
    public PayRepository() {

    }

    @Override
    protected Observable connectServer(Task task) {
        PayService service = ServiceGenerator.createService(PayService.class);

        return service.pay((PayTask) task);
    }

    @Override
    protected Func1<PayEntity, Observable> getServerData() {
        return new Func1<PayEntity, Observable>() {
            @Override
            public Observable call(PayEntity entity) {
                return Observable.just(entity);
            }
        };
    }

}
